//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/.
// 

//
// @file MobiSenseBrokerMessage.msg
// @author he huang
//

cplusplus {{
#include <CommonMessages_m.h>
#include <vector>

static const int MOBISENSEBROTYPE_L = 8;

#define MOBISENSEBROKER_LBMUL_L(msg) ( MOBISENSEBROTYPE_L + SIZEOF_INT + KEY_L )
#define MOBISENSEBROKER_LBUNI_L(msg) ( MOBISENSEBROTYPE_L + SIZEOF_INT )
#define MOBISENSEBROKER_IDMUL_L(msg) ( MOBISENSEBROTYPE_L + msg->getDestIDArraySize() * KEY_L)
}}

class noncobject OverlayKey;

// First, we declare an enum for the message type:
// Enumerations in messages MUST have a value.

enum MobiSenseBrokerMessageType 
{
    MOBISENSE_BRO_LBMUL = 1;           // broker message, location based multicast
    MOBISENSE_BRO_LBUNI = 2;           // broker message, location based unicast
    MOBISENSE_BRO_IDMUL = 3;			// broker message, id based multicast
}

packet MobiSenseBrokerPkt
{
    int type enum (MobiSenseBrokerMessageType);	// message type
}

// subscription installation message, location-based multicast
packet MobiSenseBrokerLBMulticastPkt extends MobiSenseBrokerPkt
{    
    //TargetArea area;	// target area
    //long clientID;	// unique client id
    //long sid;				// seq# of subscriptions from one client
    //long eid;				// event id
    OverlayKey src;			// source broker id of the subscription
    int level;				// level index
    //Filter filter;
}

// sensing data publishing message sending to the RP broker
packet MobiSenseBrokerLBUnicastPkt extends MobiSenseBrokerPkt
{
    //Coordinates coordinate;			// src of event
    //long eid;						// event id
    int level;						// level index
}

// notification of sensing data, id-based multicast
packet MobiSenseBrokerIDMulticastPkt extends MobiSenseBrokerPkt
{
    //long eid;						// event id
    OverlayKey destID[];		// list of end user clients
}



